<?php
   //第一步：连接数据库
   require 'db_conn.php';//如果这个文件不存在，则程序终止
   //第二步：写查询语句并执行
   $sql="select * from t_message1  ";
   $rs=$db->query($sql);
   //取结果集的行数，留言板表有多少条留言
   $num=$rs->num_rows;
   $emp=$rs->fetch_all(MYSQLI_ASSOC);//将结果集转化为数组-关联数组，下标为字符串
?>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		   <link rel="stylesheet" type="text/css" href="./css/bootstrap.css"/>
		   <script src="./js/jquery-3.4.1.js" type="text/javascript" charset="utf-8"></script>
		   <script src="./js/bootstrap.js" type="text/javascript" ></script>
	</head>
	<body>
		<div class="container">
			<h1 class="text-center">员工信息列表</h1>
			<table class="table table-bordered table-hover">
		<tr>
		<th>编号</th>
		<th>姓名</th>
		<th>头像</th>
		<th>所属部门</th>
		<th>出生日期</th>	
		<th>入职日期</th>
		<th>操作</th>
		</tr>
		<?php 
		foreach($emp as $row)
		{
		?>		
		<tr>
			<td><?php echo $row['id'] ?></td>
			<td><?php echo $row['username'] ?></td>
			<td><img src=" <?php echo $row['imgurl'] ?> " alt=""></td>
			<td><?php echo $row['dept'] ?></td>
			<td><?php echo $row['m_date'] ?></td>
		<td><?php echo $row['n_date'] ?></td>
			<td>
			<input type="button"class="btn btn-info"  value="编辑" />	
				<input type="button"class="btn btn-info"  value="删除" />
			</td>
		</tr><?php
			}
			?>	
		</table>	
		</div>
	</body>
</html>
